@extends('admin.layout')

@section('content')
    <body class="hold-transition skin-blue sidebar-mini">
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
                <li><a href="#">会员管理</a></li>
                <li class="active">添加会员</li>
            </ol>
        </section>
        <!-- Main content -->
        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-lg-12">
                    <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title"></h3>
                        </div>
                        <!-- /.box-header -->
                        <span id="msg" style="display: none">
                             @if (count($errors) > 0)
                                @foreach ($errors->all() as $error)
                                    <div style="width: 100%;">
                                        <span style="color: red;display: block;margin: 0px auto;width: 200px;text-align: center;">{{ $error }}</span>
                                    </div>
                                @endforeach
                            @endif
                         </span>
                        <script type="text/javascript">
                            var _msg = $('#msg div span').text();
                            console.log(_msg);
                            if(_msg != ''){
                                layer.msg(_msg);
                            }

                        </script>
                        <!-- form start -->
                        <form  action="{{ url('admin/addUser') }}" method="post">
                            {{ csrf_field() }}
                            <div class="box-body" style="width: 50%;">
                                <div class="form-group">
                                    <label for="exampleInputEmail1">会员名称</label>
                                    <input type="text" name="name" class="form-control" id="exampleInputEmail1" placeholder="名称">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">性别:</label>
                                    {{--<div class="col-md-6 col-sm-8 col-xs-8">--}}
                                    <input type="radio" name="sex" value="男" style="margin-left: 200px;"><span style="margin-left: 10px;">男</span>
                                    <input type="radio" name="sex" value="女" style="margin-left: 150px;"><span style="margin-left: 10px;">女</span>
                                    {{--</div>--}}
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">车牌号</label>
                                    <input type="text" name="car_num" class="form-control" id="exampleInputEmail1" placeholder="车牌号" required>
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">会员积分</label>
                                    <input type="text" name="integral" class="form-control" id="exampleInputEmail1" placeholder="会员积分" value="0">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">会员邮箱</label>
                                    <input type="text" name="email" class="form-control" id="exampleInputEmail1" placeholder="email">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">会员电话</label>
                                    <input type="text" name="phone" class="form-control" id="phone " placeholder="手机号" required>
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">会员地址</label>
                                    <textarea rows="4" name="address" class="form-control" placeholder="地址"></textarea>
                                </div>
                            </div>
                            <!-- /.box-body -->

                            <div class="box-footer">
                                <button type="submit" class="btn btn-primary">提交客户</button>
                            </div>
                        </form>
                    </div>
                    <!-- /.box -->
                    @if(Session::get('roleid') != 3)
                        <div>
                            <form action="{{ url('admin/userImp') }}" method="post" enctype="multipart/form-data">
                                {{ csrf_field() }}
                                <div class="box-body" style="width: 50%;">
                                    <div class="form-group">
                                        <label for="exampleInputName">客户信息导入:</label>
                                        <input type="file" name="file" value="" class="form-control" id="exampleInputName" >
                                    </div>
                                    <div class="form-group">
                                        <label for="exampleInputName">重复操作:</label>
                                        <input type="radio" name="radio" value="1" style="margin-left: 20px;"> 跳过重复的会员数据
                                        <input type="radio" name="radio" value="2" style="margin-left: 20px;" checked> 覆盖重复的会员数据
                                    </div>
                                    <a href="{{ url('admin/download') }}">下载模板</a>
                                </div>

                                <div class="box-footer">
                                    <button type="submit" class="btn btn-primary">提交</button>
                                </div>

                            </form>
                        </div>
                    @endif

                </div>

                <!--/.col (right) -->
            </div>
            <!-- /.row -->
        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->
@stop
